package com.hippo.core.ui.components

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import com.hippo.core.config.AppStoreKey
import com.hippo.core.core.manager.AppStore
import ru.spektrit.lycoris.viewdocument.PdfViewer

@Composable
fun PdfWatcher() {

    var url = remember { mutableStateOf<String?>(null) }

    LaunchedEffect(Unit) {
        url.value = AppStore.readString(AppStoreKey.pdfUrl,null)
    }


    url.value?.let {
        PdfViewer(
            modifier = Modifier.fillMaxSize(),
            url = it,
        )
    }

}